import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—07—06
 * Time: 18:43
 */
public class Demo01 {
    public static void main1(String[] args) {
        List<Integer> list = new LinkedList<>();

        List<String> list1 = new ArrayList<>();
        list1.add("xawl");
        list1.add("xxgcxy");
        list1.add("rjgc");
        List<String> list2 = new LinkedList<>(list1);
    }

    public static void main2(String[] args) {
        LinkedList<Integer> list = new LinkedList<>();
        list.add(12);
        list.add(25);
        list.add(45);
        list.add(67);
        System.out.println("=====1.for+下标=======");
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i) + " ");
        }
        System.out.println();
        System.out.println("======2.for-each======");
        for (int x : list) {
            System.out.print(x + " ");
        }
        System.out.println();
        System.out.println("=======3.迭代器-正向=====");
        ListIterator<Integer> it = list.listIterator();
        while(it.hasNext()) {
            System.out.print(it.next() + " ");
        }
        System.out.println();
        System.out.println("=====4.反向迭代器-反向=====");
        ListIterator<Integer> it2 = list.listIterator(list.size());
        while (it2.hasPrevious()) {
            System.out.print(it2.previous() + " ");
        }
    }

    public static void main(String[] args) {
        MyStack myStack = new MyStack();
        myStack.push(2);
        myStack.push(4);
        myStack.push(5);
        myStack.push(8);
        System.out.println(myStack.peek());
        myStack.pop();
        System.out.println(myStack.peek());


    }
}
